<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

$quantity_in_stock = ps_product::get_field( $product_id, 'product_in_stock');

if( CHECK_STOCK == '1' && ( $quantity_in_stock < 1 ) ) {
	$button_lbl = $VM_LANG->_('VM_CART_NOTIFY');
	$button_cls = 'notify_button_module';
	$notify = true;
} else {
	$button_lbl = $VM_LANG->_('PHPSHOP_CART_ADD_TO');
	$button_cls = 'addtocart_button_module';
	$notify = false;
}

?>
<div style="height: 30px;padding: 3px;width: 100%;">
<!-- The product name DIV. -->
 <?php if( $show_product_name ) : ?>
<div style="float:left; width: 70%;float: left;margin-top: 3px;padding: 3px;font-size: 14px;">
<?php echo $product_name; ?><?php echo $product_desc; ?>  
</div>
<?php endif;?>

<!-- The product price DIV. -->
<div style="width: 7%;float:left;text-align:left;margin: 5px 0;">
<?php
if( !empty($price) ) {
	echo $price;
}
?>
</div>
<?php if(JRequest::getVar('page')=='shop.browse'){?>
<!-- The add to cart DIV. -->        
<div style="float:right;text-align:right;width: 21%;">
<?php
if( !empty($addtocart_link) ) {
	?>	
	<form action="<?php echo $mm_action_url ?>index.php" method="post" name="addtocart" id="<?php echo uniqid('addtocart_') ?>" class="addtocart_form" <?php if( $this->get_cfg( 'useAjaxCartActions', 1 ) && !$notify ) { echo 'onsubmit="handleAddToCart( this.id );return false;"'; } ?>>
    <?php echo $ps_product_attribute->show_quantity_box($product_id,$product_id); ?>  
    <?php echo $ps_product_attribute->list_advanced_attribute($product_id);?>   
    <input type="hidden" name="vendor_id" value="<?php echo $vendor_id ?>" />             
    <input type="hidden" name="option" value="com_virtuemart" />
    <input type="hidden" name="page" value="shop.cart" />
    <input type="hidden" name="Itemid" value="<?php echo ps_session::getShopItemid(); ?>" /> 
    <input type="hidden" name="func" value="cartAdd" />
    <input type="hidden" name="prod_id" value="<?php echo $product_id; ?>" />
    <input type="hidden" name="product_id" value="<?php echo $product_id ?>" />
    <!--<input type="hidden" name="quantity" value="1" /> -->     
    <input type="hidden" name="set_price[]" value="" />
    <input type="hidden" name="adjust_price[]" value="" />
    <input type="hidden" name="master_product[]" value="" />
    <input type="submit" class="<?php echo $button_cls ?>" value="" title="" />
    </form> 	
	<?php
}
?>

</div>
<?php
}
?>
</div>         
